package com.pcitc.app.model;

import com.pcitc.app.model.BaseObject;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;

import java.io.Serializable;

@Entity
@Table(name="TBL_CRUDE",schema="XZGD")
public class TblCrude extends BaseObject implements Serializable {
    private String itemCode;
    private TblCrudeCategory tblCrudeCategory;
    private String itemName;
    private String itemFullname;
    private String itemDesc;
    private String itemType;
    private Long itemLevel;
    private String parentId;
    private Long pxid;

    @Id  @GeneratedValue(strategy = GenerationType.AUTO)    
    public String getItemCode() {
        return this.itemCode;
    }
    
    public void setItemCode(String itemCode) {
        this.itemCode = itemCode;
    }
@ManyToOne(fetch=FetchType.LAZY)
    @JoinColumn(name="CATEGORY_CODE")
    public TblCrudeCategory getTblCrudeCategory() {
        return this.tblCrudeCategory;
    }
    
    public void setTblCrudeCategory(TblCrudeCategory tblCrudeCategory) {
        this.tblCrudeCategory = tblCrudeCategory;
    }
    
    @Column(name="ITEM_NAME", length=80)
    public String getItemName() {
        return this.itemName;
    }
    
    public void setItemName(String itemName) {
        this.itemName = itemName;
    }
    
    @Column(name="ITEM_FULLNAME", length=256)
    public String getItemFullname() {
        return this.itemFullname;
    }
    
    public void setItemFullname(String itemFullname) {
        this.itemFullname = itemFullname;
    }
    
    @Column(name="ITEM_DESC", length=256)
    public String getItemDesc() {
        return this.itemDesc;
    }
    
    public void setItemDesc(String itemDesc) {
        this.itemDesc = itemDesc;
    }
    
    @Column(name="ITEM_TYPE", length=20)
    public String getItemType() {
        return this.itemType;
    }
    
    public void setItemType(String itemType) {
        this.itemType = itemType;
    }
    
    @Column(name="ITEM_LEVEL", precision=22, scale=0)
    public Long getItemLevel() {
        return this.itemLevel;
    }
    
    public void setItemLevel(Long itemLevel) {
        this.itemLevel = itemLevel;
    }
    
    @Column(name="PARENT_ID", length=40)
    public String getParentId() {
        return this.parentId;
    }
    
    public void setParentId(String parentId) {
        this.parentId = parentId;
    }
    
    @Column(name="PXID", precision=22, scale=0)
    public Long getPxid() {
        return this.pxid;
    }
    
    public void setPxid(Long pxid) {
        this.pxid = pxid;
    }

    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        TblCrude pojo = (TblCrude) o;

        if (tblCrudeCategory != null ? !tblCrudeCategory.equals(pojo.tblCrudeCategory) : pojo.tblCrudeCategory != null) return false;
        if (itemName != null ? !itemName.equals(pojo.itemName) : pojo.itemName != null) return false;
        if (itemFullname != null ? !itemFullname.equals(pojo.itemFullname) : pojo.itemFullname != null) return false;
        if (itemDesc != null ? !itemDesc.equals(pojo.itemDesc) : pojo.itemDesc != null) return false;
        if (itemType != null ? !itemType.equals(pojo.itemType) : pojo.itemType != null) return false;
        if (itemLevel != null ? !itemLevel.equals(pojo.itemLevel) : pojo.itemLevel != null) return false;
        if (parentId != null ? !parentId.equals(pojo.parentId) : pojo.parentId != null) return false;
        if (pxid != null ? !pxid.equals(pojo.pxid) : pojo.pxid != null) return false;

        return true;
    }

    public int hashCode() {
        int result = 0;
        result = (tblCrudeCategory != null ? tblCrudeCategory.hashCode() : 0);
        result = 31 * result + (itemName != null ? itemName.hashCode() : 0);
        result = 31 * result + (itemFullname != null ? itemFullname.hashCode() : 0);
        result = 31 * result + (itemDesc != null ? itemDesc.hashCode() : 0);
        result = 31 * result + (itemType != null ? itemType.hashCode() : 0);
        result = 31 * result + (itemLevel != null ? itemLevel.hashCode() : 0);
        result = 31 * result + (parentId != null ? parentId.hashCode() : 0);
        result = 31 * result + (pxid != null ? pxid.hashCode() : 0);

        return result;
    }

    public String toString() {
        StringBuffer sb = new StringBuffer(getClass().getSimpleName());

        sb.append(" [");
        sb.append("itemCode").append("='").append(getItemCode()).append("', ");
        sb.append("tblCrudeCategory").append("='").append(getTblCrudeCategory()).append("', ");
        sb.append("itemName").append("='").append(getItemName()).append("', ");
        sb.append("itemFullname").append("='").append(getItemFullname()).append("', ");
        sb.append("itemDesc").append("='").append(getItemDesc()).append("', ");
        sb.append("itemType").append("='").append(getItemType()).append("', ");
        sb.append("itemLevel").append("='").append(getItemLevel()).append("', ");
        sb.append("parentId").append("='").append(getParentId()).append("', ");
        sb.append("pxid").append("='").append(getPxid()).append("'");
        sb.append("]");
      
        return sb.toString();
    }

}
